package com.gzdh.tang.mobile.config;

import com.gzdh.tang.mobile.interceptor.SignInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@ComponentScan(basePackages = "com.gzdh.tang.mobile")
public class SignSpringMvcConfig implements WebMvcConfigurer {

    @Autowired
    private SignInterceptor signInterceptor;
//
//    @Autowired
//    private SMRepeatSubmitInterceptor repeatSubmitInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        //请求接口重复提交拦截器
//        InterceptorRegistration repeatSubmitRegistration = registry.addInterceptor(repeatSubmitInterceptor);
//        repeatSubmitRegistration.addPathPatterns("/api/mobile/v2/**");
//        repeatSubmitRegistration.excludePathPatterns("/**/login");
        //token认证拦截器
        InterceptorRegistration tokenRegistration = registry.addInterceptor(signInterceptor);
        tokenRegistration.addPathPatterns("/api/mobile/**");
        tokenRegistration.excludePathPatterns("/**/login");

    }
}
